package com.ktdaddy.config.token;

import com.ktdaddy.utils.JwtUtils;
import org.apache.shiro.authc.AuthenticationToken;

/**
 * @author kdaddy@163.com
 * @date 2021/4/21 22:07
 */
public class JwtToken implements AuthenticationToken {

    // 加密后的 JWT token串
    private String token;

    private String kernelName;

    public JwtToken(String token) {
        this.token = token;
        this.kernelName = JwtUtils.getClaimFiled(token, "kernelName");
    }

    @Override
    public Object getPrincipal() {
        return this.kernelName;
    }

    @Override
    public Object getCredentials() {
        return token;
    }
}
